package com.isoft.demo.controller;/*
 *@ClassName: CompensationController
 *@Date: 2021/7/7
 *@Author:刘逸飞
 */

import com.isoft.demo.common.ResponseData;
import com.isoft.demo.entity.Compensation;
import com.isoft.demo.service.CompensationService;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.Date;

@RestController
@CrossOrigin
public class CompensationController {
    @Resource
    private CompensationService service;
    @GetMapping("/addcom")
    public ResponseData addCom(Compensation com){
        ResponseData rs = service.addCom(com);
        return rs;
    }
    @GetMapping("/searchcomoid")
    public ResponseData serachComOid(){
        ResponseData rs = service.searchComOid();
        return rs;
    }
    @GetMapping("/searchallcom")
    public ResponseData serachAllCom(){
        ResponseData rs = service.searchAllCom();
        return rs;
    }
    @GetMapping("/searchComById")
    public ResponseData searchComById(int oid){
        ResponseData rs = service.searchComById(oid);
        return rs;
    }

    @GetMapping("/comConfirm")
    public ResponseData confirmCom(String date,String eid,int comid){
        //        获取当前系统时间
        Date d = new Date();
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        date=format.format(d);

        ResponseData rs = service.confirmCom(date,eid,comid);
        return rs;
    }

    @GetMapping("/findComeid")
    public ResponseData findComeid(){
        ResponseData rs = service.findComeid();
        return rs;
    }

}
